package com.lyz.dataStructure.algorithm.yitu2020;

import java.util.Scanner;

/**
 *@Author:759057893@qq.com Lyz
 *@Date: 2019/8/9 19:05
 *@Description:
 **/
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
       while (sc.hasNext()){
           int n = sc.nextInt();
           int m = sc.nextInt();
           if(n==0||m%10==4||m==0||m%10==4){
               System.out.println("illegal input");
                break;
           }
           System.out.println(shu(n,m));
       }
    }
    public static  int  shu(int n,int m){
        if(n<-100000||m>100000){
            return 0;
        }
        int count = 0;
        for(int i = n;i<m;i++){
            if((i+1)!=0&&(i+1)%10!=4&&(i+1)%10!=-4){
                count++;
            }
        }
       return count;
    }
}
